package hxy.dragon.ktor.repository

import hxy.dragon.ktor.model.GroupModel

/**
 * @description
 * @author HOX4SGH
 * @date 2024/10/10
 */
interface GroupRepository {
    fun findUser(name: String): GroupModel?
    fun addUsers(users: List<GroupModel>)
}

class GroupRepositoryImpl : GroupRepository {

    private val _users = arrayListOf<GroupModel>(GroupModel("eric"))

    override fun findUser(name: String): GroupModel? {
        return _users.firstOrNull { it.name == name }
    }

    override fun addUsers(users: List<GroupModel>) {
        _users.addAll(users)
    }
}